import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        Scanner input=new Scanner(System.in);
        int n=scanner.nextInt();
        int []a=new int[n];
        for (int i=0;i< a.length;i++)
            a[i]=input.nextInt();
        printHelloWorld();
        System.out.println(Sumd(a));
    }
    public static void printHelloWorld(){
        System.out.println("Hello World");
    }
    public static int Sumd(int a[]){
        int sum;
        int max=0;
        for(int i=0;i< a.length;i++)
        {
            sum=0;
            for(int j=i;j<a.length;j++){
                sum+=a[j];
                if(sum>max)
                    max=sum;

            }
        }


        return max;
    }
}
